home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Utilities / RemoteCommand / Source / execServer.subproj / ExecScrollText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-10  |  5.0 KB  |  120 lines

  1. // -------------------------------------------------------------------------------------
  2. // ExecScrollText.h
  3. // -------------------------------------------------------------------------------------
  4. // Permission is granted to freely redistribute this source code, and to use fragments
  5. // of this code in your own applications if you find them to be useful.  This class,
  6. // along with the source code, come with no warranty of any kind, and the user assumes
  7. // all responsibility for its use.
  8. // -------------------------------------------------------------------------------------
  9. #import <objc/Object.h>
  10.  
  11. // --------------------------------------------------------------------------------
  12. // formatted text size limit for 'textPrintf'
  13. #define         textStringSIZE          2048    // actual size cannot be known
  14.  
  15. // --------------------------------------------------------------------------------
  16. // method name synonyms
  17. #define         setAutoLF               setAutoLineFeed
  18.  
  19. // --------------------------------------------------------------------------------
  20. // errors passed by 'commandDidComplete:withError:' via 'runCommand:...'
  21. // Note: these codes may be shared by the running command which executes an exit(#)
  22. #define            RUNCMD_STOPPED            -1        // command stopped/aborted
  23. #define            RUNCMD_SUCCESS            0        // executed/completed successfully
  24. #define            RUNCMD_EXEC                255        // cannot execute execl shell
  25.  
  26. // -------------------------------------------------------------------------------------
  27. // structures used internal to ScrollText
  28.  
  29. /* text attributes */
  30. typedef struct textAttr_s {
  31.     id                    fontId;
  32.     int                    colorMode;        // 0=none, 1=gray, 2=color
  33.     NXColor                color;            // contains only gray if mode=1
  34. } textAttr_t;
  35.  
  36. // --------------------------------------------------------------------------------
  37. @interface ExecScrollText : Object
  38. #ifdef RemoteClient_PROTOCOL
  39.     <RemoteClient>
  40. #endif
  41. {
  42.  
  43.     id                    delegate;                    // delegate for ExecServer support
  44.  
  45.     id                    scrollView;                    // scroll view object
  46.     id                    textView;                    // text view object
  47.     
  48.     textAttr_t            runAttr;                    // newly added text attributes
  49.   
  50.     BOOL                wasEditable;                // scrollView was editable
  51.     BOOL                autoLf;                        // auto linefeed mode
  52.  
  53.     int                    cmdChild;                    // command execution
  54.     int                    inputDescriptor;            // input pipe
  55.  
  56. }
  57.  
  58. // --------------------------------------------------------------------------------
  59. + newExecScrollText:anObject;
  60. //  Creates a new ExecScrollText object to handle text scrolling.  anObject must be
  61. //  a ScrollView object which has a Text content view.  This is compatible
  62. //  with the outlet provided by the text scroll view object in Interface Builder.
  63. //
  64. // --------------------------------------------------------------------------------
  65. - setDelegate:aDelegate;
  66. //  Currently used for ExecServer support.  Returns self.
  67. //
  68. // --------------------------------------------------------------------------------
  69. - setAutoLineFeed:(BOOL)mode;
  70. //  Sets the autoLineFeed options.  If set to YES, then a newLine will be sent
  71. //  after each string written to the scroll text.  The default is NO. 
  72. //
  73. // --------------------------------------------------------------------------------
  74. - docView;
  75. //  Returns the ScrollView docView.
  76. //
  77. // --------------------------------------------------------------------------------
  78. - scrollView;
  79. //  Returns the ScrollView id.
  80. //
  81. // --------------------------------------------------------------------------------
  82. - setTextAttributeFont:fontId;
  83. - setTextAttributeGray:(float)aGray;
  84. - setTextAttributeColor:(NXColor)aColor;
  85. //  Set RTF font/gray run attributes for newly added text.
  86. //
  87. // --------------------------------------------------------------------------------
  88. - setTabStops:(float*)tabArray count:(int)c;
  89. - setTab:(float)tabSize count:(int)c;
  90. //  Set default tabs stops.  'setTabStops:count:' set the default tabs to those
  91. //  specified in the array 'tabArray'. 'setTab:count:' sets the default tabs to 
  92. //  multiples of 'tabSize'.  Both return self.
  93. //
  94. // --------------------------------------------------------------------------------
  95. - clearScrollText;
  96. //  This clears the contents of the Text ScrollView.  Returns self.
  97. //
  98. // --------------------------------------------------------------------------------
  99. - (int)textPrint:(const char*)buffer;
  100. - (int)textPrintf:(const char*)fmt args:(va_list)args;
  101. - (int)textPrintf:(const char*)fmt, ...;
  102. //  Appends the specified formated string to the contents of the ScrollView.
  103. //
  104. // --------------------------------------------------------------------------------
  105. - runCommand:(const char*)command;
  106. - terminateCommand;
  107. - killCommand;
  108. //  Allows running a command shell and using the scrollable text view to place the
  109. //  output.  The delegate is sent the message commandDidComplete:withError: when
  110. //  the command has completed execution.
  111. //
  112. // --------------------------------------------------------------------------------
  113. - (void)commandOutput:(const char*)buffer len:(int)len;
  114. - (void)commandDidCompleteWithError:(int)errorCode;
  115. //  Provides support for ExecServer.
  116. //
  117. // --------------------------------------------------------------------------------
  118.  
  119. @end
  120.